package com.sky.business.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sky.business.sys.domain.MQTTMessage;
import com.sky.business.sys.mapper.MQTTMessageMapper;
import com.sky.business.sys.service.MQTTMessageService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class MQTTMessageServiceImpl extends ServiceImpl<MQTTMessageMapper, MQTTMessage> implements MQTTMessageService {


    @Override
    public void deleteByCreateDateBefore(LocalDateTime date) {
        LambdaQueryWrapper<MQTTMessage> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.lt(MQTTMessage::getCreateDate,date);
        getBaseMapper().delete(queryWrapper);
    }
}
